using System;
using EForms;
using System.Drawing;

namespace CapitalReSources
{
	/// <summary>
	/// Summary description for PanelClock.
	/// </summary>
	public class StatusBarPanelClock : StatusBarPanel
	{
		private System.Windows.Forms.Timer timer;
		private int timeZone;
        public string CurrentDate;

		public StatusBarPanelClock()
		{
			timer    = new System.Windows.Forms.Timer();
			timer.Tick    += new EventHandler(TimerOnTick);
			timer.Interval = 1000;
			timer.Start();
			this.timeZone = 1;
			this.Width = 100;
		}
		private void TimerOnTick(object obj, EventArgs ea)
		{
			
			if(this.timeZone == 1)
			{
				string   strTime = DateTime.Now.ToString("T");
				this.Text = "Berlin: " + strTime ;
			}
			if(this.timeZone == -5)
			{
				DateTime dt = DateTime.Now ;
				TimeSpan ts = new TimeSpan(0,5,0,0,0);
				dt = dt.Subtract(ts);
				string   strTime = dt.ToString("T");
				this.Text = "NewYork: " + strTime;
			}
			
			
		}
		public int TimeZone
		{
			get
			{
				return this.timeZone;
			}
			set
			{
				this.timeZone = value;
				
			}
		}
	}
}
